﻿@{string urlTourPopup = Url.Action("PopupDetail", "Tour");}
@{string urlKhPopup = Url.Action("PopupDetail", "KhachHang");}

<script type="text/javascript">
    $('#id-viewdetail').live('click', function (e) {
        e.preventDefault();
        $.ajax({
            type: "GET",
            url: $(this).attr('href') + "&time=" + Math.random(),
            success: function (msg) {
                var w = document.documentElement.clientWidth;
                if (w > 800) { w = 500 }
                else if (w > 480) { 460 }
                if (msg.strView == 'KhachHang') {
                    pcKhachHang.SetContentUrl("@(urlKhPopup)" + "?id=" + msg.id);
                    pcKhachHang.SetWidth(w);
                    pcKhachHang.SetHeight(330);
                    pcKhachHang.Show();
                    //pcKhachHang.RefreshContentUrl(@(urlKhPopup));
                } else if (msg.strView == 'Tour') {
                    pcTour.SetContentUrl("@(urlTourPopup)" + "?id=" + msg.id);
                    pcTour.SetWidth(w);
                    pcTour.SetHeight(250);
                    pcTour.Show();
                    //pcTour.RefreshContentUrl();
                }
            },
            error: function (msg) {
                alert("Đã có lỗi xảy ra !");
            }
        });
    });

$('a#notify-click').live('click', function (e) {
    e.preventDefault();
    var url = $(this).attr('href') + "&time=" + Math.random();
    var w = document.documentElement.clientWidth;
    if (w > 800) { w = 500 }
    else if (w > 480) { 460 }
    pcNotify.SetContentUrl(url);
    pcNotify.SetWidth(w);
    pcNotify.SetHeight(330);
    pcNotify.Show();
});

$('a#sinhnhat-click').live('click', function (e) {
    e.preventDefault();
    $.ajax({
        type: "GET",
        url: $(this).attr('href') + "&time=" + Math.random(),
        success: function (msg) {
            var w = document.documentElement.clientWidth;
            if (w > 800) { w = 500 }
            else if (w > 480) { 460 }
            if (msg.strView == 'KhachHang') {
                pcKhachHang.SetContentUrl("@(urlKhPopup)" + "?id=" + msg.id);
                pcKhachHang.SetWidth(w);
                pcKhachHang.SetHeight(330);
                pcKhachHang.Show();
                //pcKhachHang.RefreshContentUrl(@(urlKhPopup));
            }
        }, error: function (msg) { alert("Đã có lỗi xảy ra !"); }
    });
});
</script>



@Html.DevExpress().PopupControl(
settings =>
{
    settings.Name = "pcKhachHang";
    settings.PopupElementID = "popKhachHang";
    //settings.CallbackRouteValues = new { Controller = "KhachHang", Action = "PopupDetail" };
    //settings.Width = 500;
    //settings.Height = 300;
    //settings.LoadContentViaCallback = LoadContentViaCallback.OnFirstShow;
    settings.AllowDragging = true;
    settings.EnableHotTrack = true;
    settings.ResizingMode = ResizingMode.Postponed;
    settings.Styles.Content.Paddings.Padding = 2;
    settings.PopupHorizontalAlign = PopupHorizontalAlign.WindowCenter;
    settings.PopupVerticalAlign = PopupVerticalAlign.WindowCenter;
    settings.HeaderText = "Thông tin khách hàng";
    settings.Styles.Header.ForeColor = System.Drawing.Color.Transparent; ;
    settings.Styles.Header.Font.Bold = true;
    //settings.SetContent(Html.Partial("~/Views/KhachHang/PopupDetail.cshtml").ToHtmlString());
}).GetHtml()

@Html.DevExpress().PopupControl(
settings =>
{
    settings.Name = "pcTour";
    settings.PopupElementID = "popTour";
    //settings.CallbackRouteValues = new { Controller = "Tour", Action = "ListTourKHPartial" };
    settings.ResizingMode = ResizingMode.Live;
    settings.Styles.Content.Paddings.Padding = 2;
    settings.PopupHorizontalAlign = PopupHorizontalAlign.WindowCenter;
    settings.PopupVerticalAlign = PopupVerticalAlign.WindowCenter;
    settings.HeaderText = "Thông tin tour";
    settings.Styles.Header.ForeColor = System.Drawing.Color.Transparent; ;
    settings.Styles.Header.Font.Bold = true;
    //settings.SetContent(Html.Partial("~/Views/Tour/PopupDetail.cshtml").ToHtmlString());
}).GetHtml()

@Html.DevExpress().PopupControl(
settings =>
{
    settings.Name = "pcNotify";
    settings.PopupElementID = "popNotify";
    //settings.CallbackRouteValues = new { Controller = "Tour", Action = "ListTourKHPartial" };
    settings.ResizingMode = ResizingMode.Live;
    settings.Styles.Content.Paddings.Padding = 2;
    settings.PopupHorizontalAlign = PopupHorizontalAlign.WindowCenter;
    settings.PopupVerticalAlign = PopupVerticalAlign.WindowCenter;
    settings.HeaderText = "Thông tin thao tác";
    settings.Styles.Header.ForeColor = System.Drawing.Color.Transparent; ;
    settings.Styles.Header.Font.Bold = true;
    //settings.SetContent(Html.Partial("~/Views/Tour/PopupDetail.cshtml").ToHtmlString());
}).GetHtml()
